<!doctype html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>用户登录首页</title>
    <link rel="stylesheet" href="style.css">
</head>

<body>
    <div class="container">
        <div class="welcome">欢迎登录！</div>
        登录人: <span id="loginUser"></span>
    </div>

    <script src="https://cdn.staticfile.org/jquery/3.6.4/jquery.min.js"></script>
    <script>
        // 当前登陆用户从后端获取用户名，显示到前端
        $.ajax({
            url: '/user/getUser',
            type: 'GET',
            success: function (res) {
                //res是后端方法中return的值，是String类型
                $('#loginUser').text(res);
            }
        });
        
    </script>
</body>

</html>